package vip.xiaonuo.smzq.modular.psba.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.psba.entity.PsbaSqjlDztj;
import vip.xiaonuo.smzq.modular.psba.service.IPsbaSqjlDztjService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * 评审备案申请记录-地质条件
 *
 * @author Kevin
 * @since 2024-06-11
 */
@Api(tags = "评审备案申请记录-地质条件")
@RestController
@RequestMapping("/psba/psbaSqjlDztj")
@Validated
public class PsbaSqjlDztjController {

    @Resource
    private IPsbaSqjlDztjService iPsbaSqjlDztjService;

    /**
     * 添加评审备案申请记录-地质条件
     */
    @ApiOperation("添加评审备案申请记录-地质条件")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid PsbaSqjlDztj psbaSqjlDztj) {
        iPsbaSqjlDztjService.save(psbaSqjlDztj);
        return CommonResult.ok();
    }

    /**
     * 删除评审备案申请记录-地质条件
     */
    @ApiOperation("删除评审备案申请记录-地质条件")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iPsbaSqjlDztjService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑评审备案申请记录-地质条件
     */
    @ApiOperation("编辑评审备案申请记录-地质条件")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid PsbaSqjlDztj psbaSqjlDztj) {
        iPsbaSqjlDztjService.updateById(psbaSqjlDztj);
        return CommonResult.ok();
    }

    /**
     * 评审备案申请记录-地质条件分页查询
     */
    @ApiOperation("评审备案申请记录-地质条件分页查询")
    @GetMapping("/list")
    public CommonResult<Page<PsbaSqjlDztj>> page() {
        return CommonResult.data(iPsbaSqjlDztjService.page(new PsbaSqjlDztj()));
    }
}
